/*
 * @Author: wanghuan wanghuan@sgsimulation.com
 * @Date: 2024-09-05 11:13:47
 * @LastEditors: Du Weixing duweixing@sgsimulation.com
 * @LastEditTime: 2024-12-07 20:11:50
 * @FilePath: /SGFEM/DataStructure/Input/Element/ElementBase.h
 */
/**
 *  @file
 *  @brief   单元数据基类定义
 *  @author  wuxingchuang
 *  @date    2024.03.30
 *  @version  v1.0
 *  @par Copyright(c):  ShenGong  Simulation corporation
 */

#pragma once
#include "DataStructure/Common/DataStructureNamespace.h"
#include "DataStructure/Common/Id.h"
#include "DataStructure/Common/SGObject.h"
#include "DataStructure/Input/Element/ElementTypes.h"

SG_DATASTRUCTURE_FEM_NAMESPACE_OPEN
/** @brief 单元基类
 *
 * 提供单元计算部分的共有部分
 */
struct DECLSPEC ElementBase : public SGObject
{
    ElementBase () = default;
    ElementBase (SG::DataStructure::Common::Id id);
};

inline ElementBase::ElementBase (SG::DataStructure::Common::Id id) : SGObject (id)
{}

SG_DATASTRUCTURE_FEM_NAMESPACE_CLOSE

namespace SG
{
    namespace DBManager
    {
        namespace HDF5
        {
            template <typename T>
            class SingleRepositoryBase;
        }
    }  // namespace DBManager
}  // namespace SG

// 友元声明，允许标准库容器和相关函数访问构造函数
// 这些类因为都是基类，所以不允许私自创建
// 请使用具体节点数的子类来创建实例
#define DB_CREATE_FRIEND()                       \
    template <typename T, typename Allocator>    \
    friend class std::vector;                    \
    template <typename T>                        \
    friend class std::allocator;                 \
    template <typename T>                        \
    friend struct std::allocator_traits;         \
                                                 \
    template <typename T, typename... Args>      \
    friend void std::_Construct (T*, Args&&...); \
                                                 \
    template <typename T>                        \
    friend class SG::DBManager::HDF5::SingleRepositoryBase;
